import { lazy } from "react";
import {Navigate} from "react-router-dom"
const Login=lazy(()=>import('../pages/Login'));
const Layout=lazy(()=>import('../pages/Layout'));
const Home=lazy(()=>import('../pages/Home'));
const FindRoom=lazy(()=>import('../pages/FindRoom'));
const Publish=lazy(()=>import('../pages/Publish'));
const Message=lazy(()=>import('../pages/Message'));
const My=lazy(()=>import('../pages/My'));
const BayRoom=lazy(()=>import('../pages/BuyRoom'));



export const pages=[
    {
        path:'/home',
        element:<Home/>,
    },
    {
        path:'/find',
        element:<FindRoom/>,
    },
    {
        path:'/publish',
        element:<Publish/>,
    },
    {
        path:'/msg',
        element:<Message/>,
    },
    {
        path:'/my',
        element:<My/>,
    },
    {
        path:'/buyroom',
        element:<BayRoom/>
    },
    {
        path:'',
        element:<Navigate to="/home"/>,
    }
]
const router=[
    {
        path:'/login',
        element:<Login/>,
    },
    {
        path:'/',
        element:<Layout/>,
        children:pages
    }
];


export default router;